# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=cgdb
pkgver=0.7.0
pkgrel=1
pkgdesc="Curses-based interface to the GNU Debugger"
arch=('i686' 'x86_64')
url="https://cgdb.sourceforge.io/"
license=('GPL')
depends=('libreadline' 'ncurses' 'gdb')
makedepends=('help2man' 'libreadline-devel' 'ncurses-devel')
source=("https://cgdb.me/files/${pkgname}-${pkgver}.tar.gz"
        01-msysize.patch)
sha512sums=('406830b5c0f8035df39571f01c20442b76c2509d069d6eb151c239e1cd30132ac6c4a404b8c96cdd8a06297d3c600c7b016a7d95cee2fda285b11fd21b391209'
            '31d2f2573fec3e6569b0c236d60898e5fced21bd3510add98613ce2e75f966a923917ed6eeec475844c3545004d0a17b55de96cfa3eb6f68d5a84636c563ef0e')
install=cgdb.install

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/01-msysize.patch

  autoreconf -fi -I config
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure \
    --prefix=/usr \
    --build=${CHOST} \
    --with-readline=/usr \
    --with-ncurses=/usr
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}/" install
}
